package com.zhuangjie.mvc.enhance.mp_query_enhance.utils;


import com.zhaungjie.base.utils.LambdaStructureParser.LambdaStructureParser;

import java.util.Map;

/**
 * plusGet HashMap
 *
 * @author zhuangjie
 * @date 2024/04/30
 */
public class LambdaGetHashMap<V> extends java.util.HashMap<String,V> {
    public<T> V get(LambdaStructureParser.NAHRFunction<T,?> fun) {
        return super.get(LambdaStructureParser.convertToFieldName(fun));
    }

    @Override
    public int hashCode() {
        // A simple way to compute a hashCode that depends on entries.
        return this.entrySet().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) return true;
        if (!(o instanceof Map)) return false;
        Map<?, ?> other = (Map<?, ?>) o;
        // Simply use Map's equals method for comparison.
        return this.entrySet().equals(other.entrySet());
    }


}
